<?php

namespace App\Http\Controllers;

use App\models\Order;
use App\models\OrderGoods;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;

class TestController extends Controller
{
    //
    public function getGoods(Request $request)
    {
        $r = Auth::attempt(['user_id'=>3001,'password'=>encrypt(123456)]);

        $array = Arr::add([['name' => 'Desk']], 'price', 100);
        dump($array);
        return;
        //Session::flash('key-flash','vvv-val-flash');
        echo Session::get('key-flash');
        return;

        $request->session()->push('key','val');
        Session::put('key','val');
        Session::push('key','valu');


        $request->session()->get('key');



        $request->session()->put('key1','val1');
//        echo $request->session()->get('key1');

        session()->put('key2','val2');
//        echo session()->get('key2');

//        Session::put(['key2'=>'val2']);
//        echo Session::get('key2');

        Session::push('key3','val3');
        Session::push('key3','val4');
        dump(Session::forget('key3'));
        dump(Session::all());
        dump(Session::has('key3'));
        dump(Session::has('key4'));
        return 1;
//        $request->session()->put('name','king');
//        return 1;
//        $sess = Session::make('name','king');
//        return response(200)->session($sess);

        $r = Order::find(1523)->getOrderGoods;
        dd($r);
        $r = OrderGoods::find(1791)->getGoodsOrder;
        dd($r);
    }
}
